<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户实体属性关系图</title>
    <script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.css">
    <style>
        body {
            font-family: 'Arial', sans-serif;
            background-color: #f5f5f5;
            margin: 0;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .container {
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            margin-bottom: 20px;
            max-width: 800px;
            width: 100%;
        }
        h1 {
            color: #2c3e50;
            text-align: center;
            margin-bottom: 30px;
        }
        .mermaid {
            margin: 30px 0;
            display: flex;
            justify-content: center;
        }
        .mermaid svg {
            max-width: 100%;
            height: auto;
        }
        .primary-key {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>用户实体属性关系图</h1>
        <div class="mermaid">
            %%{init: {'theme': 'default', 'themeVariables': { 'fontSize': '16px', 'nodeTextPadding': 22 }}}%%
            graph TD
                %% 实体定义
                User[用户]

                %% 属性定义（主键加下划线）
                UserId((<u>id</u>)):::attributeClass
                UserName((username)):::attributeClass
                UserPassword((password)):::attributeClass
                UserRole((role)):::attributeClass
                UserPhone((phone)):::attributeClass
                UserEmail((email)):::attributeClass
                UserStatus((status)):::attributeClass

                %% 连接实体和属性
                User --- UserId
                User --- UserName
                User --- UserPassword
                User --- UserRole
                User --- UserPhone
                User --- UserEmail
                User --- UserStatus

                %% 主键标注
                UserId -.->|PK| User
                
                %% 自定义CSS类
                classDef attributeClass fill:#f9f5eb,stroke:#b97a57,stroke-width:1px,color:#333
        </div>
    </div>
    <script>
        mermaid.initialize({
            startOnLoad: true,
            securityLevel: 'loose',
            theme: 'default',
        });
    </script>
</body>
</html> 